home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / dev / misc / LEDA_gene.lha / LEDA-3.1c-generic / incl / LEDA / point1.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-10  |  1.5 KB  |  76 lines

  1. /*******************************************************************************
  2. +
  3. +  LEDA  3.1c
  4. +
  5. +
  6. +  point1.h
  7. +
  8. +
  9. +  Copyright (c) 1994  by  Max-Planck-Institut fuer Informatik
  10. +  Im Stadtwald, 6600 Saarbruecken, FRG     
  11. +  All rights reserved.
  12. *******************************************************************************/
  13.  
  14.  
  15. #ifndef LEDA_POINT1_H
  16. #define LEDA_POINT1_H
  17.  
  18. #include <LEDA/list.h>
  19. #include <LEDA/vector.h>
  20.  
  21. class point1 {
  22.  
  23. friend class line;
  24. friend class circle;
  25.    
  26.    double x;
  27.    double y;
  28.  
  29. public:
  30.     
  31.    point1(double a=0, double b=0) { x = a; y = b; }
  32.    point1(vector v) { x = v[0]; y = v[1]; }
  33.    
  34.  
  35.  LEDA_MEMORY(point1)
  36.  
  37. operator vector()         { return vector(x,y); }
  38.  
  39. double  xcoord()  const   { return x; }
  40. double  ycoord()  const   { return y; }
  41.  
  42. double  angle(const point1&, const point1&) const;
  43.  
  44. double  distance(const point1&) const;
  45. double  distance() const;
  46.  
  47. point1   translate(double,double) const;
  48. point1   translate(const vector&) const;
  49.  
  50. point1   rotate(const point1&,double) const;
  51. point1   rotate(double) const;
  52.  
  53.  
  54. point1 operator+(const vector& v) const { return translate(v); }
  55.  
  56. int operator==(const point1&) const;
  57.  
  58. int operator!=(const point1& p)  const { return !operator==(p);}
  59.  
  60. friend ostream& operator<<(ostream& out, const point1& p) ;
  61. friend istream& operator>>(istream& in, point1& p) ;
  62.  
  63. friend int  compare(const point1&, const point1&);
  64.  
  65. };
  66.  
  67. inline void Print(const point1& p, ostream& out) { out << p; } 
  68. inline void Read(point1& p,  istream& in)        { in >> p; }
  69.  
  70. LEDA_TYPE_PARAMETER(point1)
  71.  
  72.  
  73. #endif
  74.  
  75.